import sys
users = open("users.dat")
output = open(sys.argv[1])
counter = 0
counterap = 0.0

for user in users:
	userids = [(int(i) + 1) for i in user.split(' ')[1:]]
	out = output.readline()
	outids = [int(i) for i in out.split(',')[1].split(';')[:5]]
	i = 0.0
	j = 0.0
	ap = 0.0
	for id in outids:
		j += 1.0
		if id in userids:
			i += 1.0
			counter += 1
			ap += i / j
	if i > 0:
		counterap += ap / i

print counter / 5551.0, counterap / 5551.0
